<?php include_once ("../coresection/connection.php");?>



<?php 
//sms发送功能  

 
//这个是地址例子

//http://o.origin.com/message/mail.php?token=16856821@qq.com&&mail1=16856821@qq.com&&mail2=wubilly@sina.com&&mail3=16856821@qq.com&&mail4=16856821@qq.com&&mail5=16856821@qq.com
//http://message.phonix-ltd.com/sms/sms.php?token=phonix20140808&&phone1=13535350765&&phone2=13888098685&&phone3=&&phone4=&&phone5=&&content=x
//http://www.smsbao.com/sms?u=USERNAME&p=PASSWORD                        &m=PHONE      &c=CONTENT
//http://www.smsbao.com/sms?u=kulaex2 &p=0d2c43122811cb513503717778dd4384&m=13535350765&c=x


//这个token需要验证一下是否存在。
$token=$_REQUEST ['token'];
//请读取这边的数据库，然后对照是否存在token



//设置需要搜索的表格的前缀后缀
$table_suffix="user";
$table=$table_Prefix.$table_suffix;
 
$result = do_query("select * from $table");//	查出这个id的产品的各个termid
	
while($row = mysqli_fetch_array($result))
  {
  $user_nid[]=$row['nid'];
  $user_name[]=$row['name'];
  $user_publish[]=$row['publish'];
  $user_token[]=$row['token'];
  }




for($i=0;$i<count($user_nid);$i++)
{
	echo $user_token[$i];
 if($token==$user_token[$i])
 {
	 send_sms();
 }
}






function send_mail()
{
//send mail on




$m_phone01=addslashes($_REQUEST ['phone1']);
$m_phone02=addslashes($_REQUEST ['phone2']);
$m_phone03=addslashes($_REQUEST ['phone3']);
$m_phone04=addslashes($_REQUEST ['phone4']);
$m_phone05=addslashes($_REQUEST ['phone5']);

$content=addslashes($_REQUEST ['content']);

 

//存成数组，用来循环用
$phonenumber=array($m_phone01,$m_phone02,$m_phone03,$m_phone04,$m_phone05); 



//开始循环每个地址，存在就发送出去。
for($i=0;$i<=4;$i++)
{

if($phonenumber[$i])
{


$number       =$phonenumber[$i];
$password     =md5('kate98154981');
$url_Prefix   ="http://www.smsbao.com/sms?u=kulaex2&p=".$password;
$url_Suffix   ="&m=".$number."&c=".$content;

echo $url_Prefix.$url_Suffix."<br/>";

file_get_contents($url_Prefix.$url_Suffix);

echo "posted to sms center.<br/>";
 
 
}

}




}//function end
 
?>
 
